<?php


/**
 * This class defines the structure of the 'state' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    orm.map
 */
class StateTableMap extends TableMap {

	/**
	 * The (dot-path) name of this class
	 */
	const CLASS_NAME = 'orm.map.StateTableMap';

	/**
	 * Initialize the table attributes, columns and validators
	 * Relations are not initialized by this method since they are lazy loaded
	 *
	 * @return     void
	 * @throws     PropelException
	 */
	public function initialize()
	{
	  // attributes
		$this->setName('state');
		$this->setPhpName('State');
		$this->setClassname('State');
		$this->setPackage('orm');
		$this->setUseIdGenerator(true);
		// columns
		$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, 11, null);
		$this->addColumn('NAME', 'Name', 'VARCHAR', true, 50, null);
		$this->addForeignKey('COUNTRY_ID', 'CountryId', 'VARCHAR', 'country', 'ID', true, 5, null);
		$this->addColumn('IS_ACTIVE', 'IsActive', 'CHAR', false, 1, 'Y');
		$this->addColumn('ADDED_DATE', 'AddedDate', 'DATE', false, null, null);
		// validators
	} // initialize()

	/**
	 * Build the RelationMap objects for this table relationships
	 */
	public function buildRelations()
	{
    $this->addRelation('Country', 'Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), null, null);
    $this->addRelation('City', 'City', RelationMap::ONE_TO_MANY, array('id' => 'state_id', ), null, null);
    $this->addRelation('Restaurant', 'Restaurant', RelationMap::ONE_TO_MANY, array('id' => 'state_id', ), null, null);
	} // buildRelations()

} // StateTableMap
